/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func findKthToTail(pListHead *ListNode, k int) *ListNode {
	if pListHead == nil {
		return nil
	}
	b := pListHead
	var arr []int
	for {
		if b.Next != nil {
			arr = append(arr, b.Val)
			b = b.Next
		} else {
			arr = append(arr, b.Val)
			break
		}
	}
	if k > len(arr) {
		return nil
	} else if k == len(arr) {
		return pListHead
	}

	cnt := 0
	b = pListHead
	for {
		if cnt == len(arr)-k {
			return b
		} else {
			b = b.Next
			cnt++
		}
	}
}